package cn.wen.yinxiu.member.dao;

import cn.wen.yinxiu.member.entity.FriendEntity;
import cn.wen.yinxiu.member.vo.UserFriend;
import cn.wen.yinxiu.member.vo.UserFriendInfo;
import cn.wen.yinxiu.member.vo.UserFriendQuery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName: FriendDao
 * @Author 小飞
 * @Email coderwen22@163.com
 * @Date 2023-05-21 22:19:26
 * @Description: 朋友Dao层
 */
@Component
@Mapper
public interface FriendDao extends BaseMapper<FriendEntity> {

    /**
     * 传入基本参数 通过用户Id来获取该用户的朋友Id列表
     *
     * @param userId
     * @param status
     * @param isDeleted
     * @return
     */
    List<Long> selectFriendIdByUserId(@Param("meId") Long userId,
                                      @Param("status") Integer status,
                                      @Param("isDeleted") Integer isDeleted);

    /**
     * 通过用户Id来获取该用户的朋友基本信息列表
     *
     * @param userId
     * @param status
     * @param isDeleted
     * @param pageSize
     * @return
     */
    List<UserFriendInfo> selectFriendInfoByUserId(@Param("meId") Long userId,
                                                  @Param("status") Integer status,
                                                  @Param("isDeleted") Integer isDeleted,
                                                  @Param("page") Integer page,
                                                  @Param("pageSize") Integer pageSize);

    /**
     * 批量添加朋友
     *
     * @param userFriendList
     */
    void saveBatchUserFriend(@Param("list") List<UserFriend> userFriendList);

    /**
     * 当前用户的粉丝列表
     *
     * @param userId
     * @param status
     * @param isDeleted
     * @param page
     * @return
     */
    List<UserFriendInfo> selectFansInfoByUserId(@Param("meId") Long userId,
                                                @Param("status") Integer status,
                                                @Param("isDeleted") Integer isDeleted,
                                                @Param("page") Integer page,
                                                @Param("pageSize") Integer pageSize);

    /**
     * 查询账号或者用户名
     * @param query
     * @param status
     * @param isDeleted
     * @param page
     * @return
     */
    List<UserFriendInfo> searchUserFriendInfoList(@Param("query") UserFriendQuery query,
                                                  @Param("status") Integer status,
                                                  @Param("isDeleted") Integer isDeleted,
                                                  @Param("page") Integer page,
                                                  @Param("pageSize") Integer pageSize);

    /**
     * 通过查询音秀账号和用户名来查询粉丝信息
     * @param query
     * @param status
     * @param isDeleted
     * @param page
     * @return
     */
    List<UserFriendInfo> searchUserFansInfoList(@Param("query") UserFriendQuery query,
                                                @Param("status") Integer status,
                                                @Param("isDeleted") Integer isDeleted,
                                                @Param("page") Integer page,
                                                @Param("pageSize") Integer pageSize);

    /**
     * 获取互关对象信息
     *
     * @param userId
     * @param status
     * @param isDeleted
     * @return
     */
    List<Long> queryUserFriendIdList(@Param("userId") Long userId,
                                     @Param("status") Integer status,
                                     @Param("isDeleted") Integer isDeleted);
}
